import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/login',
    },
    {
      path:'/login',
      name:'login',
      component: () => import('../views/LoginView.vue'),
    },
    {
      path: '/home',
      name:'home',
      component: import('../views/HomeView.vue'),
    },
    {
      path:'/fl',
      name: 'fl',
      component: () => import('../views/FlView.vue')
    },
    {
      path:'/jc',
      name: 'jc',
      component: () => import('../views/JcView.vue')
    },
    {
      path:'/jl',
      name: 'jl',
      component: () => import('../views/JlView.vue')
    },
      {
      path:'/js',
      name: 'js',
      component: () => import('../views/JsView.vue')
    },
    {
      path:'/start',
      name: 'start',
      component: () => import('../views/StartView.vue')
    },
    {
      path:'/login',
      name:'login',
      component:()=>import('../views/LoginView.vue')
    },
    {
      path:'/my',
      name:'my',
      component:()=>import('../views/MyView.vue')
    }
  ],
})

//导航守卫、路由守卫、路由拦截
// router.beforeEach((to,from,next) =>{
//   //验证token,只有存在token的时候，才能跳转到内容页
//   console.log(to);
//   console.log(from);
//   let token = localStorage.getItem("token");
//   if(token || to.path === '/login'){
//     next();
//     console.log(token);
//   }else{
//     next("/login");
//   }
// })


export default router
